﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using CTP.Entitys;

namespace CTP.ComWrap
{
    [ComVisible(false)]
    public delegate void OnQueryFilledHandle(QueryFilledEventArgs e);

    [Guid("dde77491-0ede-4ab2-854f-88526d49acd4")]
    public interface IQueryFilledEventArgs
    {
        ReturnInfo ReturnInfo { get; set; }
        OrderReport[] Reports { get; set; }
        int RequestID { get; set; }
        int RecordCount { get; }
        OrderReport Get(int index);
    }

    [Guid("3c0ef343-b2bd-41ff-acc7-c4fb02ad53e1")]
    [ClassInterface(ClassInterfaceType.None)]
    public class QueryFilledEventArgs : EventArgs, IQueryFilledEventArgs
    {
        public ReturnInfo ReturnInfo { get; set; }
        public OrderReport[] Reports { get; set; }
        public int RequestID { get; set; }
        public int RecordCount { get { return Reports.Length; } }
        public OrderReport Get(int index)
        {
            if (Reports == null || Reports.Length < 1 || index < 0 || index >= Reports.Length)
                return new OrderReport();

            return Reports[index];
        }
    }

}
